package com.farm.chain;

public class LowFuelHandler implements EmergencyHandler {
    private EmergencyHandler nextHandler;

    @Override
    public void setNextHandler(EmergencyHandler nextHandler) {
        this.nextHandler = nextHandler;
    }

    @Override
    public void handleRequest(EmergencyRequest request, String machineName) {
        if (request.getType().equals("LOW_FUEL")) {
            System.out.println(machineName + "低油量处理器处理: " + request.getMessage());
            System.out.println(machineName + "执行操作: 通知最近的加油站，规划最短路径前往");
        } else if (nextHandler != null) {
            nextHandler.handleRequest(request, machineName);
        }
    }
}
